<x-layout>
    <!-- 轮播图 -->
    <div id="focusslide" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
            @foreach($toplist as $key => $item)
                @if($key==0)
                    <li data-target="#focusslide" data-slide-to="{{$key}}" class="active"></li>
                @else
                    <li data-target="#focusslide" data-slide-to="{{$key}}"></li>
                @endif
            @endforeach
        </ol>

        <div class="carousel-inner" role="listbox">
            @foreach($toplist as $key => $item)
                <div class="item {{$key == 0 ? 'active' : ''}}"> 
                    <a href="{{url('/info', ['artid' => $item->id])}}" target="_blank">
                        <img src="{{URL::asset($item->thumb)}}" class="img-responsive">
                    </a>
                </div>
            @endforeach
        </div>

        <a class="left carousel-control" href="#focusslide" role="button" data-slide="prev" rel="nofollow"> 
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> 
            <span class="sr-only">上一个</span> 
        </a> 
        
        <a class="right carousel-control" href="#focusslide" role="button" data-slide="next" rel="nofollow"> 
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 
            <span class="sr-only">下一个</span> 
        </a>
    </div>

    <!-- 导航栏 -->
    <div class="title">
        <h3>{{isset($type->name) ? $type->name : '所有文章'}}</h3>
        <div class="more">
        <a href="{{url('/')}}">全部</a>
            @foreach($typelist as $item)
            <a href="{{url('/', ['typeid' => $item->id])}}">{{$item->name}}</a>
            @endforeach
        </div>
    </div>

    <!-- 文章列表 -->
    @foreach($artlist as $item)
    <article class="excerpt excerpt-1">
        <a href="{{url('/info', ['artid' => $item->id])}}" class="focus">
            <img class="thumb" src="{{URL::asset($item->thumb)}}" />
        </a>

        <header>
            @if($item->typeid)
                <a href="{{url('/info', ['artid' => $item->id])}}" class="cat" href="program">{{$item->type->name}}<i></i></a>
            @endif

            <h2>
                <a href="{{url('/info', ['artid' => $item->id])}}">
                    {{$item->title}}
                </a>
            </h2>
        </header>

        <p class="meta">
            <time class="time">
                <i class="glyphicon glyphicon-time"></i> {{$item->created_at}}
            </time>
            <span class="views">
                <i class="glyphicon glyphicon-eye-open"></i> 共{{$item->visit ? $item->visit : 0}}人围观
            </span> 
            
            <a href="{{url('/info', ['artid' => $item->id])}}" class="comment" href="article.html#comment">
                <i class="glyphicon glyphicon-comment"></i> {{$item->comment}}人评论
            </a>
        </p>

        <p class="note">
            {{ Str::limit($item->content, 200)}}
        </p>
    </article>
    @endforeach

    <!-- 分页样式 -->
    <nav class="pagination">
        {{ $artlist->onEachSide(1)->links() }}
    </nav>
</x-layout>